﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UI.Admin.Content.ModelArticle.Default1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" href="/Admin/assets/css/jquery-ui-1.10.3.full.min.css" />
    <script>
        // 删除内容
        function submit_delete_content(ID) {         
        $("#dialog-confirm").removeClass('hide').dialog({
            resizable: false,
            modal: true,
            title: "<div class='widget-header'><h4 class='smaller'><i class='icon-warning-sign red'></i>删除文章</h4></div>",
            title_html: true,
            buttons: [
                {
                    html: "<i class='icon-trash'></i>&nbsp; 删除",
                    "class": "btn btn-danger btn-xs",
                    click: function () {
                        var s = "";
                        s = $.ajax({
                            type: "POST",
                            url: "AjaxAction.ashx",
                            data: {
                                dowhat: "delete_article",
                                ColumnID: $("#ColumnID").val(),                 
                                ID: ID
                            },
                            async: false
                        }).responseText;
                        if (s == "success") {
                            window.location.href = "Default.aspx" + location.search;
                        }
                    }
                }
                ,
                {
                    html: "<i class='icon-remove'></i>&nbsp; 取消",
                    "class": "btn btn-xs",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
            ]
        });
        };
   </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
        <div class="row">
	    <div class="col-xs-12">           		    
                <h3 class="header smaller lighter blue">
	                <%=BLL.Find.FindOneColumn(ColumnID).Name %>
	                <small>
		                <i class="icon-double-angle-right"></i>
		                文章列表
	                </small>
                    &nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-primary btn-sm" href="Create.aspx?ColumnID=<%=ColumnID%>"><i class="icon-plus"></i>添加文章</a>
                </h3>              
             <div class="table-header badge-primary">
			    表的每一个列名都可以作为排序的关键字，点击小三角形进行排序操作
		    </div>
		    <div class="table-responsive">
			    <table id="sample-table-2" class="table table-striped  table-hover">
				    <thead class="">
					    <tr>
						 
						    <th>ID</th>
                            <th>标题</th>				
						    <th>时间</th>
						    <th>编辑者</th>
						    <th>状态</th>                        
						    <th></th>
					    </tr>
				    </thead>

				    <tbody>

                    <%for(int i=0;i<list.Count;i++){ %>
					    <tr>
						   

						    <td><%=list[i].ID %></td>
						    <td><%=list[i].Title %></td>
						    <td><%=Utility.Tool.GetShortDate(list[i].UpdateDate.ToString()) %></td>
						    <td><%=list[i].LastEditor %></td>
						    <td><%=list[i].Status %></td>
						    <td>
							    <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
							

								    <a class="green" href="Edit.aspx?ID=<%=list[i].ID %>&ColumnID=<%=ColumnID %>">
									    <i class="icon-pencil bigger-130"></i>
								    </a>

								    <a class="red" href="javascript:void(0)" onclick="submit_delete_content(<%=list[i].ID %>)">
									    <i class="icon-trash bigger-130"></i>
								    </a>
							    </div>
						    </td>
					    </tr>
                         
                     <%} %>  
	      
				    </tbody>
			    </table>
		    </div>
	    </div>
    </div>
     <div id="dialog-confirm" class="hide">
		<div class="alert alert-info bigger-110">
			删除操作执行后不可恢复
		</div>

		<div class="space-6"></div>

		<p class="bigger-110 bolder center grey">
			<i class="icon-hand-right blue bigger-120"></i>
			Are you sure?
		</p>
	</div><!-- #dialog-confirm -->
     <input type="hidden" id="ColumnID" value="<%=ColumnID %>" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
     <script src="/Admin/assets/js/jquery.dataTables.min.js" charset="GB2312"></script>
	<script src="/Admin/assets/js/jquery.dataTables.bootstrap.js" charset="GB2312"></script>
    <script src="/Admin/assets/js/jquery-ui-1.10.3.full.min.js"></script>
	<script src="/Admin/assets/js/jquery.ui.touch-punch.min.js"></script>

    <script type="text/javascript">
        jQuery(function ($) {
            var oTable1 = $('#sample-table-2').dataTable({
                "aoColumns": [
			      
			      null, null, null, null, null,
				  { "bSortable": false }
                ]
            });


            $('table th input:checkbox').on('click', function () {
                var that = this;
                $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

            });


            $('[data-rel="tooltip"]').tooltip({ placement: tooltip_placement });
            function tooltip_placement(context, source) {
                var $source = $(source);
                var $parent = $source.closest('table')
                var off1 = $parent.offset();
                var w1 = $parent.width();

                var off2 = $source.offset();
                var w2 = $source.width();

                if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
                return 'left';
            }

        })
        $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
            _title: function (title) {
                var $title = this.options.title || '&nbsp;'
                if (("title_html" in this.options) && this.options.title_html == true)
                    title.html($title);
                else title.text($title);
            }
        }));
    </script>
</asp:Content>
